//
//  HomeLabel.m
//  Gegeda_music_MY
//
//  Created by lanou3g on 15/10/31.
//  Copyright (c) 2015年 周莹. All rights reserved.
//

#import "HomeLabel.h"

@implementation HomeLabel

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.textAlignment = NSTextAlignmentCenter;
        self.font = [UIFont systemFontOfSize:24];
        self.userInteractionEnabled = YES;
        self.scale = 0.0;
    }
    return self;
}

- (void)setScale:(CGFloat)scale
{
    _scale = scale;
    
    // scale == 0.0 == blue == 0.0 0.0 1.0
    // scale == 1.0 == yellow == 1.0 1.0 0.0
    
    // 颜色渐变
    self.textColor = [UIColor colorWithRed:scale green:1-scale blue:1-scale alpha:1.0];
    
    // 大小渐变
    CGFloat minWhScale = 0.6; // [0.7, 1.0]
    CGFloat whScale = minWhScale + scale * (1 - minWhScale);
    self.transform = CGAffineTransformMakeScale(whScale, whScale);
}

@end
